package com.kb.mapper.mysql;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.kb.entity.Header;
import com.kb.entity.Organization;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface OrganizationDao extends BaseMapper<Organization> {
    @Select("SELECT * FROM db_resources.organization " +
            "WHERE organization_name = #{organizationName} " +
            "LIMIT 1")
    Organization selectByOrgName(String organizationName);

    //insert语句
    @Insert("INSERT INTO db_resources.organization (id, organization_name, organization_english_name, uscc, " +
            "organization_logo, organization_description, organization_documents, " +
            "organization_picture1, organization_picture2, organization_picture3, legal_persons, " +
            "organization_type, contact, contact_number, email, address, organization_state, " +
            "audit_state, auditor, audit_time, audit_remark, business_scope, industry, region, " +
            "postal_code, website, adfm_option, bdfm_option, recommend_sequence, recommend_setting, " +
            "trustor_dfm_option, create_time, update_time, creator, updater, deleted, tenant_id,data_source) " +
            "VALUES (#{id}, #{organizationName}, #{organizationEnglishName}, #{uscc}, " +
            "#{organizationLogo}, #{organizationDescription}, #{organizationDocuments}, " +
            "#{organizationPicture1}, #{organizationPicture2}, #{organizationPicture3}, #{legalPersons}, " +
            "#{organizationType}, #{contact}, #{contactNumber}, #{email}, #{address}, #{organizationState}, " +
            "#{auditState}, #{auditor}, #{auditTime}, #{auditRemark}, #{businessScope}, #{industry}, #{region}, " +
            "#{postalCode}, #{website}, #{adfmOption}, #{bdfmOption}, #{recommendSequence}, #{recommendSetting}, " +
            "#{trustorDfmOption}, #{createTime}, #{updateTime}, #{creator}, #{updater}, #{deleted}, #{tenantId},#{dataSource})")
    int insertOrganization(Organization organization);
}